package com.dhcc.bpm.modules.resource.wrapper;

import com.dhcc.bpm.common.cache.DictCache;
import com.dhcc.bpm.modules.resource.entity.Oss;
import com.dhcc.bpm.modules.resource.entity.OssVO;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;

/**
 * @ClassName OssWrapper.class
 * @Description  包装类,返回视图层所需的字段
 * @Author xiaFaYu
 * @Date 2020-02-03 14:16
 * @Version V1.0
 * @Copyright:2020东华软件.All rights reserved.
 **/
public class OssWrapper extends BaseEntityWrapper<Oss, OssVO> {

	public static OssWrapper build() {
		return new OssWrapper();
	}

	@Override
	public OssVO entityVO(Oss oss) {
		OssVO ossVO = BeanUtil.copy(oss, OssVO.class);
		assert ossVO != null;
		String categoryName = DictCache.getValue("oss", oss.getCategory().toString());
		String statusName = DictCache.getValue("yes_no", oss.getStatus().toString());
		ossVO.setCategoryName(categoryName);
		ossVO.setStatusName(statusName);
		return ossVO;
	}

}
